#include <stdio.h>
int main(void) {
	int city , highway , start , des ;//城市数量，高速路数量，出发地，目的地
	scanf("%d %d %d %d" , &city , &highway , &start , &des) ;
	int choice[highway][4] ;
	for(int i=0 ; i<highway ; i++) {
		scanf("%d %d %d %d" , &choice[i][0] , &choice[i][1] , &choice[i][2] , &choice[i][3]) ;
		//城市1 ，城市2 ， 高速路长度 ， 收费额 
	} 
	
	int length , sum ;
	length = sum = 0 ;
	for(int i=0 ; i<highway ; i++) {
		if(choice[i][0]==start || choice[i][1]==start) {
			int item_length , item_sum ;
			item_length = choice[i][2] ;
			item_sum = choice[i][3] ;
			int now , next ;
			if(choice[i][0]==start) {
				now = choice[i][0] ;
				next = choice[i][1] ;				
			}
			else if(choice[i][1]==start) {
				now = choice[i][1] ;
				next = choice[i][0] ;				
			}

			int j;
			while(next!=des){
				j = 0 ;
				while(j<highway) {
					if(j!=i && (choice[j][0]==next || choice[j][1]==next)){
						item_length += choice[j][2] ;
						item_sum += choice[j][3] ;
						if(choice[j][0]==next) {
							now = choice[j][0] ;
							next = choice[j][1] ;
						}
						else if(choice[j][1]==next) {
							now = choice[j][1] ;
							next = choice[j][0] ;	
						}
					}
                    j ++ ;
				}
				if(j==highway)
					break ;
			}
			if(next==des) {
				if(length==0) {
					length = item_length ;
					sum = item_sum ;
				}
				else if(item_length<length)	{
					length = item_length ;
					sum = item_sum ;
				}
				else if(item_length==length) {
					if(item_sum<sum) {
						length = item_length ;
						sum = item_sum ;
					}
				}	
			}
		}
	} 
	
	printf("%d %d" , length , sum) ;
	return 0 ;
}